# Archlive <http://archlive-pkg.googlecode.com>

pkgname=squashfs
pkgver=4.0
pkgrel=1
pkgdesc="Squashfs kernel module with squashfs tools, squashfs is a highly compressed read-only filesystem for Linux."
url="http://squashfs.sourceforge.net"
license=("GPL")
arch=('i686' 'x86_64')
depends=('zlib' 'glibc')
source=(http://downloads.sourceforge.net/sourceforge/squashfs/squashfs$pkgver.tar.gz
	squashfs.tar.gz::"http://git.kernel.org/?p=linux/kernel/git/pkl/squashfs-linus.git;a=snapshot;h=e5d287539dba264a1d9d7607a25b8c8c61c9d658"
)
provides=(squashfs squashfs-tools)
conflicts=(sqlzma sqlzma29 sqlzma30 sqlzma-tools)
install=(squashfs.install)
md5sums=()

_kernver=`uname -r`

build()
{
	#编译squashfs模块
	cp -Raf /usr/src/linux-$_kernver $srcdir
	cp -f $srcdir/linux/kernel/git/stable/linux-2.6.30.y.git/* $srcdir/linux-$_kernver/fs/squashfs/
	cd $srcdir/linux-$_kernver
	sed -i "/# CONFIG_SQUASHFS is not set/ c\CONFIG_SQUASHFS=m\
		\n# CONFIG_SQUASHFS_EMBEDDED is not set \
		\nCONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3" .config
	make modulesprepare
	make CONFIG_SQUASHFS=m M=fs/squashfs modules || return 1
	install -d $pkgdir/lib/modules/$_kernver/kernel/fs/squashfs/
	cp fs/squashfs/squashfs.ko $pkgdir/lib/modules/$_kernver/kernel/fs/squashfs/

	cd $srcdir/squashfs$pkgver/$pkgname-tools
	make || return 1
	mkdir -p $startdir/pkg/sbin
	cp -a mksquashfs unsquashfs $startdir/pkg/sbin
}